<template>
  <div class="home">
    <header>
      <p>
        <span>宏烨经纪人</span>
        <span>... o</span>
      </p>
      <dl>
        <dt>
          <!-- <img
            src="https://img0.baidu.com/it/u=3667925427,1702898091&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500"
            alt
          />-->
          <img :src="img" alt />
        </dt>
        <dd>
          <!-- <p>黄庆涛</p> -->
          <p>{{name}}</p>
        </dd>
      </dl>
    </header>
    <main>
      <div class="dllist">
        <router-link v-for="(item, index) in items" :key="index" :to="item.path">
          <p>
            <!-- <i :class="item.icon"></i> -->
            188
          </p>
          <p>{{item.name}}</p>
          <!-- <p v-for="(v, i) in dlList" :key="i">{{v.name}}</p> -->
        </router-link>
        <!-- <p v-for="(item, index) in dlList" :key="index">{{item.name}}</p> -->
      </div>
      <div class="linklist">
        <router-link v-for="(item, index) in linklist" :key="index" :to="item.path">
          <p>
            <i :class="item.icon"></i>
          </p>
          <p>{{item.name}}</p>
        </router-link>
      </div>
      <p class="hqt" v-for="(v, i) in dlList" :key="i">{{v.name}}</p>
    </main>
  </div>
</template>

<script>
import axios from "axios";
import { log } from "util";
import { dlList } from "../../api/index";

export default {
  data() {
    return {
      name: sessionStorage.getItem("name"),
      img: sessionStorage.getItem("img"),
      dlList: [],

      items: [
        {
          path: "newhouse",
          icon: "el-icon-s-home",
          name: "新房"
        },
        {
          path: "secondhouse",
          icon: "el-icon-data-line",
          name: "二手房"
        },
        {
          path: "taxihouse",
          icon: "el-icon-data-line",
          name: "出租房"
        }
      ],

      linklist: [
        {
          path: "news",
          icon: "el-icon-s-comment",
          name: "消息"
        },
        {
          path: "wanted",
          icon: "el-icon-s-home",
          name: "求租"
        },
        {
          path: "buy",
          icon: "el-icon-s-home",
          name: "求购"
        },
        {
          path: "housingring",
          icon: "el-icon-star-off",
          name: "楼市圈"
        },
        {
          path: "live",
          icon: "el-icon-video-camera",
          name: "直播"
        },
        {
          path: "group",
          icon: "el-icon-data-line",
          name: "团购"
        },
        {
          path: "rankinglist",
          icon: "el-icon-data-line",
          name: "排行榜"
        },
        {
          path: "record",
          icon: "el-icon-loading",
          name: "战绩"
        }
      ]
    };
  },
  created() {
    this.dllist();
  },
  methods: {
    //dllist数据
    dllist() {
      dlList().then(res => {
        if (res.data.code === 0) {
          this.$router.push("/login");
          this.$toast(res.data.msg);
        } else {
          this.dlList = res.data.data;
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  header {
    height: 320px;
    background-color: rgb(77, 157, 211);
    p {
      padding-top: 10px;
      font-size: 24px;
      display: flex;
      justify-content: space-between;
      span {
        color: #fff;
      }
      span:first-child {
        padding-left: 20px;
      }
      span:nth-child(2) {
        width: 60px;
        height: 36px;
        border-radius: 18px;
        margin-right: 20px;
        border: 1px solid rgb(255, 255, 255);
      }
    }
    dl {
      width: 120px;
      height: 120px;
      margin-left: 40%;
      text-align: center;

      dt {
        width: 80px;
        height: 80px;
        border-radius: 80px;
        border: 1px solid rgb(152, 190, 235);
        img {
          width: 100%;
          height: 100%;
          border-radius: 100px;
        }
      }
      dd {
        p {
          font-size: 16px;
          color: #fff;
          padding-left: 14px;
        }
      }
    }
  }
  main {
    width: 100%;
    height: 100%;
    position: relative;
    .dllist {
      display: flex;
      justify-content: space-around;
      align-items: center;
      position: absolute;
      margin: -40px 8%;
      width: 85%;
      border: 1px solid rgb(212, 207, 207);
      background-color: #fff;
      height: 80px;
      border-radius: 15px;
      text-align: center;
      p {
        font-size: 16px;
        color: rgb(185, 175, 175);
      }
     
      p:first-child {
        color: rgb(97, 176, 201);
        font-size: 26px;
      }
    }
    .linklist {
      margin-top: 70px;
      width: 100%;
      height: 300px;
      display: flex;
      text-align: center;
      flex-wrap: wrap;
      a {
        font-size: 18px;
        // display: block;
        width: calc(100% / 3);
        i {
          font-size: 28px;
        }
      }
      a:first-child {
        color: blue;
      }
      a:nth-child(2) {
        color: rgb(219, 104, 241);
      }
      a:nth-child(3) {
        color: rgb(104, 241, 166);
      }
      a:nth-child(4) {
        color: rgb(225, 247, 30);
      }
      a:nth-child(5) {
        color: rgb(211, 77, 133);
      }
      a:nth-child(6) {
        color: rgb(214, 127, 46);
      }
      a:nth-child(7) {
        color: rgb(23, 175, 180);
      }
      a:nth-child(8) {
        color: rgb(10, 207, 221);
      }
    }
    .hqt {
      display: none;
    }
  }
}
</style>